<?php
/**
 * Created by PhpStorm.
 * User: songs
 * Date: 2020/7/13
 * Time: 14:50
 */

namespace app\components\Api;

use app\components\Fun;
use app\components\Lcms;
use app\models\user\gc\ChanliangchannengGcModel;
use app\models\user\gc\User_basechanpin_gcModel;
use app\models\user\gc\Users_zhengjianshangchuan_gcModel;
use app\models\user\gc\UsersBaseGcModel;
use app\models\user\gc\UsersBaseinfoGc;
use app\models\user\gr\UserOtherinfoGr;
use app\models\user\gr\Users_zhengjianshangchuan_GrModel;
use app\models\user\gr\UsersBaseGrModel;
use app\models\user\gr\UsersBaseinfoGr;
use app\models\user\gc\UserShebeiGcModel;
use app\models\user\gc\UsersHuanjingGc;
use app\models\user\gc\UserZhiliangyaoqiuGc;
use app\models\user\gs\User_basechanpin_gsModel;
use app\models\user\gs\Users_zhengjianshangchuan_gsModel;
use app\models\user\gs\UsersBaseGsModel;
use app\models\user\gs\UsersBaseinfoGs;
use  app\components\OA;
use app\models\user\gs\UsersHuanjingGs;
use Yii;
use app\components\API;

class User
{
    /**
     * @apiGroup 用户
     * @api {post} /api/app/call/getNowUserInfo 获取用户信息
     * @apiSuccess {string} id 用户id
     * @apiSuccess {string} username 昵称
     * @apiSuccess {string} avatar 头像地址
     * @apiSuccess {string} phone 用户的手机号,相当于用户账号
     * @apiSuccess {string} is_company 是否启用公司
     * @apiSuccess {string} is_factory 是否启用工厂
     * @apiSuccess {string} is_yingpin 是否启用应聘
     * @apiSuccess {string} jiguang[0] appKey
     * @apiSuccess {string} jiguang[1] 随机字符串
     * @apiSuccess {string} jiguang[2] timestamp
     * @apiSuccess {string} jiguang[3] signature
     * @apiSuccess {string} jiguang[4] jiguang_id
     * @apiSuccess {string} jiguang[0] jiguang_pass
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":{"id":"5714","name":"\u5b8b\u5e05","head":"http:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/mECo2RefIzQJBaZoibKdviccZURsYMHY6ACEIIp73Is0lLpnic8jlVMl5Sia09icnTCf5ekUr8zrwqPG4MfJlQOxfyQ\/132","phone":"15560195082","is_company":0,"is_factory":null,"is_yingpin":null,"jiguang":["ebc58098e670c47189b05396","070826702f3f9824904e78a3a29e4dfb","1595731194123","3adeca193a3b0fbf2669d939f683f040","mc_3fcf7c5918d8abc602cff4b5f528b8bd","54bdffcb3c378d2c1144e212506e613e"]}}
     * @apiUse ERROR
     */
    public function getNowUserInfo()////info()
    {
        $id = Yii::$app->user->getId();
        $one = \app\models\User::find()->where([
            'id' => $id
        ])->select([
            'id', 'username', 'avatar', 'phone', 'is_company', 'is_factory', 'is_yingpin', 'jiguang_id',
        ])->one();///->toArray();
        if (!$one) {
            \app\components\API::echo_json(0, null);
        }
        $data = [
            'id' => $one['id'],
            'username' => $one['username'],
            //  'avatar' => $one['avatar'],
            'avatar' => Fun::$HOST . '/api/app/avatar?jid=' . $one['jiguang_id'],
            'phone' => $one['phone'],
            'is_company' => $one['is_company'],
            'is_factory' => $one['is_factory'],
            'is_yingpin' => $one['is_yingpin'],
            //'jiguang_id' => $one['jiguang_id'],
            'jiguang' => JMessageApi::getJiguangArray()
        ];
        \app\components\API::echo_json(0, $data);
    }


    /**
     * @apiGroup 用户
     * @api {post} /api/app/call/setUserTypeIntroducer 设置用户的类型
     * @apiParam {int} type  101表示公司;102表示工厂;103表示个人应聘
     * @apiParam {string} introducer 表示介绍人的手机号码
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":"ok"}
     *
     * @apiUse ERROR
     */
    public function setUserTypeIntroducer()
    {
        $user = Yii::$app->user->getModel();
        $user->introducer = Yii::$app->request->post('introducer');
        $user->type = Yii::$app->request->post('type');
        $r = $user->update();
        if ($r === false) {
            API::echo_json(1, '系统错误,请重试');
        }
        \app\components\API::echo_json(0, 'ok');
    }


    /**
     * @apiGroup 用户
     * @api {post} /api/app/call/getUserTypeIntroducer 获取用户的类型
     * @apiSuccess {int} type  101表示公司(BaseUserModel::user_type_gongsi);102表示工厂(BaseUserModel::user_type_gongchang=);103表示个人应聘(BaseUserModel::user_type_geren)
     * @apiSuccess {string} introducer 表示介绍人的手机号码
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":"ok"}
     *
     * @apiUse ERROR
     */
    public function getUserTypeIntroducer()
    {

        $user = Yii::$app->user->getModel([
            'id', 'username', 'avatar',
            'phone', 'is_company',
            'is_factory', 'is_yingpin',
            'jiguang_id', 'jiguang_pass', 'type', 'introducer'
        ]);

        \app\components\API::echo_json(0, [
            'type' => $user->type,
            'introducer' => $user->introducer,
        ]);
    }


    /**
     * @apiGroup 用户 公司信息
     * @api {post} /api/app/call/getusers_info_gs 获取公司资料完善情况
     *
     *
     * @apiSuccess {int} isbase 基本信息  显示基本信息是否填写,证件是否上传,公司产品是否上传等等 是否填写 未填写是0,如果填写是非0,后期可能会改成完成的百分比
     * @apiSuccess {int} iszhengjian 证件上传
     * @apiSuccess {int} isgongsichanpin 公司产品
     *
     * @apiSuccess {int} ischanpinfengge 产品风格
     * @apiSuccess {int} iszhiliangbiaozhun 质量标准
     * @apiSuccess {int} isgongsihuanjing 公司环境
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":{"isbase":0,"iszhengjian":0,"isgongsichanpin":0,"ischanpinfengge":0,"iszhiliangbiaozhun":0,"isgongsihuanjing":0}}
     *
     * @apiUse ERROR
     */
    public function getusers_info_gs()
    {
        $one = UsersBaseinfoGs::find()->where([
            'id' => Yii::$app->user->getId()
        ])->select([
            'isbase', 'iszhengjian', 'isgongsichanpin',
            'ischanpinfengge', 'iszhiliangbiaozhun', 'isgongsihuanjing',
        ])->one();
        if (!$one) {
            OA::Json(0, [
                'isbase' => 0,
                'iszhengjian' => 0,
                'isgongsichanpin' => 0,

                'ischanpinfengge' => 0,
                'iszhiliangbiaozhun' => 0,
                'isgongsihuanjing' => 0,
            ]);
        } else {
            OA::Json(0, $one->toArray());
        }
    }


    /**
     * @apiGroup 用户 工厂信息
     * @api {post} /api/app/call/getusers_info_gc 获取工厂资料完善情况
     *
     *
     * @apiSuccess {int} isbase 基本信息  显示基本信息是否填写,证件是否上传,公司产品是否上传等等 是否填写 未填写是0,如果填写是非0,后期可能会改成完成的百分比
     * @apiSuccess {int} iszhengjian 证件上传
     * @apiSuccess {int} isgongchangchanpin 公司产品
     *
     * @apiSuccess {int} isgongchangshebei      工厂设备
     * @apiSuccess {int} ischanpinchanneng      产品产能
     * @apiSuccess {int} iszhiliangyaoqiu       质量要求
     * @apiSuccess {int} isgongchanghuanjing    工厂环境
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":{"isbase":0,"iszhengjian":0,"isgongsichanpin":0,"ischanpinfengge":0,"iszhiliangbiaozhun":0,"isgongsihuanjing":0}}
     *
     * @apiUse ERROR
     */
    public function getusers_info_gc()
    {
        $one = UsersBaseinfoGc::find()->where([
            'id' => Yii::$app->user->getId()
        ])->select([
            'isbase', 'iszhengjian', 'isgongchangchanpin',
            'isgongchangshebei', 'ischanpinchanneng', 'iszhiliangyaoqiu', 'isgongchanghuanjing'
        ])->one();
        //  var_dump(Yii::$app->user->getId());exit;
        if (!$one) {
            OA::Json(0, [
                'isbase' => 0,
                'iszhengjian' => 0,
                'isgongchangchanpin' => 0,

                'isgongchangshebei' => 0,
                'ischanpinchanneng' => 0,
                'iszhiliangyaoqiu' => 0,
                'isgongchanghuanjing' => 0,
            ]);
        } else {
            OA::Json(0, $one->toArray());
        }
    }


    /**
     * @apiGroup 用户 个人求职
     * @api {post} /api/app/call/getusers_info_gr 获取个人资料完善情况
     *
     *
     * @apiSuccess {int} isbase 基本信息  显示基本信息是否填写,证件是否上传,公司产品是否上传等等 是否填写 未填写是0,如果填写是非0,后期可能会改成完成的百分比
     * @apiSuccess {int} iszhengjian 证件上传
     *
     * @apiSuccess {int} isjiaoyubeijing      教育背景
     * @apiSuccess {int} isgongzuojingli      工作经历
     * @apiSuccess {int} isjiatingchengyuan       家庭成员
     * @apiSuccess {int} isqiuzhiyixiang    求职意向
     * @apiSuccess {int} isziwopingjia    自我评价
     * @apiSuccess {string|null} qiuzhiyixiangType    求职意向类型,'qiuzhiyixiangType_GS'表示公司员工，'qiuzhiyixiangType_GC'表示工厂员工,如果为0或者null表示没有选择
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":{"isbase":0,"iszhengjian":0,"isgongsichanpin":0,"ischanpinfengge":0,"iszhiliangbiaozhun":0,"isgongsihuanjing":0}}
     *
     * @apiUse ERROR
     */
    public function getusers_info_gr()
    {
        $one = UsersBaseinfoGr::find()->where([
            'id' => Yii::$app->user->getId()
        ])->select([
            'isbase', 'iszhengjian',
            'isjiaoyubeijing', 'isgongzuojingli', 'isjiatingchengyuan'
            , 'isqiuzhiyixiang', 'isziwopingjia', 'qiuzhiyixiangType'
        ])->one();
        //  var_dump(Yii::$app->user->getId());exit;
        if (!$one) {
            OA::Json(0, [
                'isbase' => 0,
                'iszhengjian' => 0,
                'isgongchangchanpin' => 0,

                'isjiaoyubeijing' => 0,
                'isgongzuojingli' => 0,
                'isjiatingchengyuan' => 0,
                'isqiuzhiyixiang' => 0,
                'isziwopingjia' => 0,
                'qiuzhiyixiangType' => null
            ]);
        } else {
            $one['qiuzhiyixiangType'] = $one->toqiuzhiyixiangTypeIntStr($one['qiuzhiyixiangType']);
            OA::Json(0, $one->toArray());
        }
    }


    /**
     * @apiGroup 用户 公司信息
     * @api {post} /api/app/call/getusers_baseinfo_gs 获取公司基本信息
     * @apiSuccess {string} comCity 公司定位
     * @apiSuccess {string} com_address 具体位置
     * @apiSuccess {string} com_name 单位名称
     * @apiSuccess {string} com_tel 座机号
     * @apiSuccess {string} legal_mobile 手机号
     * @apiSuccess {string} legal_name 法人姓名
     * @apiSuccess {string} legal_sex 性别 1男，2女
     * @apiParam {string} lng lng
     * @apiParam {string} lat lat
     * @apiSuccess {string} detail 公司简介
     * @apiSuccess {string} nianxiaoshou1 年销售额1
     * @apiSuccess {string} nianxiaoshou2 年销售额2
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":{"comCity":"\u6cb3\u5357\u7701\u65b0\u4e61\u5e02\u7ea2\u65d7\u533a\u4e1c\u8857\u8857\u9053\u7ea2\u65d7\u533a\u7ea2\u623f\u5c0f\u533a","com_address":"\u9ec4\u6cb3\u5927\u9053","com_name":"adsa","com_tel":"7898778","legal_mobile":"15677788888","legal_name":"fdsag","legal_sex":1,"position":"{\"Q\":35.30263351161239,\"R\":113.88399100050327,\"lng\":113.883991,\"lat\":35.302634,\"zoom\":16}","detail":"\u516c\u53f8\u7684\u7b80\u4ecb","nianxiaoshou1":"0","nianxiaoshou2":"0"}}
     *
     *
     *
     */
    public function getusers_baseinfo_gs($post, $returnrray)
    {
        $usercom = UsersBaseGsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$usercom) {
            $usercom = new UsersBaseGsModel();
        }
        $returnrray['comCity'] = $usercom->comCity;
        $returnrray['com_address'] = $usercom->com_address;
        $returnrray['com_name'] = $usercom->com_name;
        $returnrray['com_tel'] = $usercom->com_tel;
        $returnrray['legal_mobile'] = $usercom->legal_mobile;
        $returnrray['legal_name'] = $usercom->legal_name;
        $returnrray['legal_sex'] = $usercom->legal_sex;
        $returnrray['lng'] = $usercom->lng;
        $returnrray['lat'] = $usercom->lat;
        $returnrray['detail'] = $usercom->detail;
        $nianxiaoshou1 = $usercom->nianxiaoshou;
        $returnrray['nianxiaoshou1'] = 0;
        $returnrray['nianxiaoshou2'] = 0;
        if ($nianxiaoshou1 && $nianxiaoshou1 != '') {
            $list = explode(',', $nianxiaoshou1);
            $returnrray['nianxiaoshou1'] = $list[0] ?? 0;
            $returnrray['nianxiaoshou2'] = $list[1] ?? 0;
        } else {
            $returnrray['nianxiaoshou1'] = 0;
            $returnrray['nianxiaoshou2'] = 0;
        }
        OA::Json(0, $returnrray);
    }

    /**
     * @apiGroup 用户 工厂信息
     * @api {post} /api/app/call/getusers_baseinfo_gc 获取工厂基本信息
     * @apiSuccess {string} comCity 工厂定位
     * @apiSuccess {string} com_address 具体位置
     * @apiSuccess {string} com_name 单位名称
     * @apiSuccess {string} com_tel 座机号
     * @apiSuccess {string} legal_mobile 手机号
     * @apiSuccess {string} legal_name 法人姓名
     * @apiSuccess {string} legal_sex 性别 1男，2女
     * @apiParam {string} lng lng
     * @apiParam {string} lat lat
     * @apiSuccess {string} detail 工厂简介
     * @apiSuccessExample 返回
     *
     *{"code":0,"data":{"comCity":"\u6cb3\u5357\u7701\u65b0\u4e61\u5e02\u7ea2\u65d7\u533a\u4e1c\u8857\u8857\u9053\u7ea2\u65d7\u533a\u7ea2\u623f\u5c0f\u533a","com_address":"\u9ec4\u6cb3\u5927\u9053","com_name":"adsa","com_tel":"7898778","legal_mobile":"15677788888","legal_name":"fdsag","legal_sex":1,"position":"{\"Q\":35.30263351161239,\"R\":113.88399100050327,\"lng\":113.883991,\"lat\":35.302634,\"zoom\":16}","detail":"\u516c\u53f8\u7684\u7b80\u4ecb","nianxiaoshou1":"0","nianxiaoshou2":"0"}}
     *
     *
     *
     */
    public function getusers_baseinfo_gc($post, $returnrray)
    {
        $usercom = UsersBaseGcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$usercom) {
            $usercom = new UsersBaseGcModel();
        }
        $returnrray['comCity'] = $usercom->comCity ?? '';
        $returnrray['com_address'] = $usercom->com_address ?? '';
        $returnrray['com_name'] = $usercom->com_name ?? '';
        $returnrray['com_tel'] = $usercom->com_tel ?? '';
        $returnrray['legal_mobile'] = $usercom->legal_mobile ?? '';
        $returnrray['legal_name'] = $usercom->legal_name ?? '';
        $returnrray['legal_sex'] = $usercom->legal_sex ?? '';
        $returnrray['lat'] = $usercom->lat ?? '';
        $returnrray['lng'] = $usercom->lng ?? '';
        $returnrray['detail'] = $usercom->detail ?? '';

        OA::Json(0, $returnrray);
    }


    /**
     * @apiGroup 用户 个人求职
     * @api {post} /api/app/call/getusers_baseinfo_gr 获取个人基本信息
     * @apiSuccess {string|null} $name 姓名
     * @apiSuccess {int|null} $sex 法人性别：1男，2女
     * @apiSuccess {string|null} $zhuanye 专业
     * @apiSuccess {string|null} $jiguan 籍贯
     * @apiSuccess {int} $tizhong 体重
     * @apiSuccess {string|null} $minzu 民族
     * @apiSuccess {int|null} $gongzuonianxian 工作年限
     * @apiSuccess {string|null} $zhengzhimianmao 政治面貌
     * @apiSuccess {string|null} $hukoudizhi 户口地址
     * @apiSuccess {int|null} $visible 0表示隐藏,1表示显示,和功能开关对应
     * @apiSuccess {int|null} $time 创建时间
     * @apiSuccess {string|null} $xianzhudizhi 现住地址
     * @apiSuccess {string|null} $jinjilianxiren 紧急联系人
     * @apiSuccess {string|null} $jinjilianxirendianhua 紧急联系人电话
     * @apiSuccess {int|null} $hunyinzhuangtai 婚姻状态
     * @apiSuccess {int|null} $chushengnianyue 出生年月
     * @apiSuccessExample 返回
     *
     * {"code":0,"data":{"name":null,"sex":null,"zhuanye":null,"jiguan":null,"tizhong":null,"minzu":null,"gongzuonianxian":null,"zhengzhimianmao":null,"hukoudizhi":null,"xianzhudizhi":null,"jinjilianxiren":null,"jinjilianxirendianhua":null,"hunyinzhuangtai":null,"chushengnianyue":null}}
     *
     *
     */
    public function getusers_baseinfo_gr($post, $returnrray)
    {
        $returnrray = UsersBaseGrModel::getInfo([
            'name', 'sex', 'zhuanye', 'jiguan',
            'tizhong', 'minzu', 'gongzuonianxian', 'zhengzhimianmao', 'hukoudizhi',
            'xianzhudizhi', 'jinjilianxiren', 'jinjilianxirendianhua', 'hunyinzhuangtai', 'chushengnianyue'
        ]);
        if ($returnrray['chushengnianyue'] && $returnrray['chushengnianyue'] != '') {
            $returnrray['chushengnianyue'] = Fun::date_d($returnrray['chushengnianyue']);
        }
        OA::Json(0, $returnrray);
    }


    /**
     * @apiGroup 用户 个人求职
     * @api {post} /api/app/call/setusers_baseinfo_gr 修改个人基本信息
     * @apiParam {string|null} name 姓名
     * @apiParam {int|null} sex 法人性别：1男，2女
     * @apiParam {string|null} zhuanye 专业
     * @apiParam {string|null} jiguan 籍贯
     * @apiParam {int} $tizhong 体重
     * @apiParam {string|null} $minzu 民族
     * @apiParam {int|null} gongzuonianxian 工作年限
     * @apiParam {string|null} zhengzhimianmao 政治面貌
     * @apiParam {string|null} $hukoudizhi 户口地址
     * @apiParam {int|null} $visible 0表示隐藏,1表示显示,和功能开关对应
     * @apiParam {int|null} $time 创建时间
     * @apiParam {string|null} $xianzhudizhi 现住地址
     * @apiParam {string|null} $jinjilianxiren 紧急联系人
     * @apiParam {string|null} $jinjilianxirendianhua 紧急联系人电话
     * @apiParam {int|null} $hunyinzhuangtai 婚姻状态 1表示单身 2表示结婚
     * @apiParam {int|null} $chushengnianyue 出生年月
     *
     */
    public function setusers_baseinfo_gr($post, $returnrray)
    {
        if (empty($post['chushengnianyue'])) {
            API::echo_json(1, '出生年月必须填写');
        }
        $post['chushengnianyue'] = strtotime($post['chushengnianyue']);
        $r = UsersBaseGrModel::setInfo([
            'name', 'sex', 'zhuanye', 'jiguan',
            'tizhong', 'minzu', 'gongzuonianxian', 'zhengzhimianmao', 'hukoudizhi',
            'xianzhudizhi', 'jinjilianxiren', 'jinjilianxirendianhua', 'hunyinzhuangtai', 'chushengnianyue'
        ], $post);
        UsersBaseinfoGr::setIS('isbase', 1);
        if ($r) {
            API::echo_json(0, $r);
        }
    }


    /**
     * @apiGroup 用户 公司信息
     * @api {post} /api/app/call/setusers_baseinfo_gs 修改公司基本信息
     * @apiParam {string} comCity 公司定位
     * @apiParam {string} com_address 具体位置
     * @apiParam {string} com_name 单位名称
     * @apiParam {string} com_tel 座机号
     * @apiParam {string} legal_mobile 手机号
     * @apiParam {string} legal_name 法人姓名
     * @apiParam {string} legal_sex 性别 1男，2女
     * @apiParam {string} position 经纬度
     * @apiParam {string} detail 公司的简介
     * @apiParam {string} nianxiaoshou1 年销售额1
     * @apiParam {string} nianxiaoshou2 年销售额2
     * @apiSuccessExample 返回
     *
     *com_name: adsa
     * legal_name: fdsag
     * legal_sex: 1
     * legal_mobile: 15677788888
     * com_tel: 7898778
     * comCity: 河南省新乡市红旗区东街街道红旗区红房小区
     * com_address: 黄河大道
     * nianxiaoshou1: 0
     * nianxiaoshou2: 0
     * detail: 公司的简介
     * @apiParam {string} lng lng
     * @apiParam {string} lat lat
     * app_access: qSoiKwpWVge4TkaryH6MKvOdceGt7ZMaF20g8H0cnXI
     *
     *
     */
    public function setusers_baseinfo_gs($post, $returnrray)
    {
        $usercom = UsersBaseGsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$usercom) {
            $usercom = new UsersBaseGsModel;
            $usercom->time = time();
            $usercom->uid = Yii::$app->user->getId();
        }
        $usercom->shenhe = UsersBaseGsModel::shenhe_no;
        $usercom->visible = 0;
        $usercom->com_name = $post['com_name'] ?? '';
        $usercom->legal_name = $post['legal_name'] ?? '';
        $usercom->legal_sex = $post['legal_sex'] ?? '';
        $usercom->legal_mobile = $post['legal_mobile'] ?? '';
        $usercom->com_tel = $post['com_tel'] ?? '';
        $usercom->comCity = $post['comCity'] ?? '';
        $usercom->com_address = $post['com_address'] ?? '';
        $usercom->lng = $post['lng'] ?? '';
        $usercom->lat = $post['lat'] ?? '';
        $usercom->detail = $post['detail'] ?? '';
        $usercom->nianxiaoshou = ($post['nianxiaoshou1'] ?? '') . ',' . ($post['nianxiaoshou2'] ?? '');
        if ($usercom->save() !== false) {
            UsersBaseinfoGs::setIS('isbase');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }

//@ apiParam {string} position 经纬度

    /**
     * @apiGroup 用户 工厂信息
     * @api {post} /api/app/call/setusers_baseinfo_gc 修改工厂基本信息
     * @apiParam {string} comCity 工厂定位
     * @apiParam {string} com_address 具体位置
     * @apiParam {string} com_name 单位名称
     * @apiParam {string} com_tel 座机号
     * @apiParam {string} legal_mobile 手机号
     * @apiParam {string} legal_name 法人姓名
     * @apiParam {string} legal_sex 性别 1男，2女
     * @apiParam {string} lng lng
     * @apiParam {string} lat lat
     * @apiParam {string} detail 工厂简介
     * @apiSuccessExample 返回
     *
     *com_name: adsa
     * legal_name: fdsag
     * legal_sex: 1
     * legal_mobile: 15677788888
     * com_tel: 7898778
     * comCity: 河南省新乡市红旗区东街街道红旗区红房小区
     * com_address: 黄河大道
     * detail: 公司的简介
     * app_access: qSoiKwpWVge4TkaryH6MKvOdceGt7ZMaF20g8H0cnXI
     *
     *
     */
    public function setusers_baseinfo_gc($post, $returnrray)
    {
        $usercom = UsersBaseGcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$usercom) {
            $usercom = new UsersBaseGcModel;
            $usercom->time = time();
            $usercom->uid = Yii::$app->user->getId();
        }
        $usercom->shenhe = UsersBaseGsModel::shenhe_no;
        $usercom->visible = 0;
        $usercom->com_name = $post['com_name'] ?? '';
        $usercom->legal_name = $post['legal_name'] ?? '';
        $usercom->legal_sex = $post['legal_sex'] ?? '';
        $usercom->legal_mobile = $post['legal_mobile'] ?? '';
        $usercom->com_tel = $post['com_tel'] ?? '';
        $usercom->comCity = $post['comCity'] ?? '';
        $usercom->com_address = $post['com_address'] ?? '';
        $usercom->lng = $post['lng'] ?? '';
        $usercom->lat = $post['lat'] ?? '';
        $usercom->detail = $post['detail'] ?? '';

        if ($usercom->save() !== false) {
            UsersBaseinfoGc::setIS('isbase');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }


    /**
     * @apiGroup 用户 公司信息
     * @api {post} /api/app/call/getusers_zhengjianshangchuan_gs 获取公司证件上传的情况
     * @apiSuccess {string|NULL} xingxiangzhao 形象照
     * @apiSuccess {string|NULL} shenfenzhengzhengmian 身份证正面
     * @apiSuccess {string|NULL} shenfenzhengfanmian 身份证反面
     * @apiSuccess {string|NULL} jiangzhuang    奖状
     * @apiSuccess {string|NULL} jiehunzheng     结婚证
     *
     * @apiSuccess {string|NULL} jiashizheng 驾驶证
     * @apiSuccess {string|NULL} zuzhijiegoudaimazhao    组织结构代码照
     * @apiSuccess {string|NULL} yingyezhizhao 营业执照
     * @apiSuccess {string|NULL} shuiwudengjizheng 税务登记证
     * @apiSuccess {string|NULL} zulinhetongzhao 租赁合同照
     *
     * @apiSuccess {string|NULL} geleixukezheng 各类许可证
     * @apiSuccess {string|NULL} geleirongyu 各类荣誉
     * @apiSuccess {string|NULL} fangchanzheng 房产证
     * @apiSuccessExample 返回
     * {"code":0,"data":{"xingxiangzhao":null,"shenfenzhengzhengmian":null,"shenfenzhengfanmian":null,"jiangzhuang":null,"jiehunzheng":null,"jiashizheng":null,"zuzhijiegoudaimazhao":null,"yingyezhizhao":null,"shuiwudengjizheng":null,"zulinhetongzhao":null,"geleixukezheng":null,"geleirongyu":null,"fangchanzheng":null}}
     */
    public function getusers_zhengjianshangchuan_gs($post, $returnrray)
    {
        $findmodel = Users_zhengjianshangchuan_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->select([
            'xingxiangzhao',
            'shenfenzhengzhengmian',
            'shenfenzhengfanmian',
            'jiangzhuang',
            'jiehunzheng',

            'jiashizheng',
            'zuzhijiegoudaimazhao',
            'yingyezhizhao',
            'shuiwudengjizheng',
            'zulinhetongzhao',

            'geleixukezheng',
            'geleirongyu',
            'fangchanzheng',
        ])->one();
        if (!$findmodel) {
            $findmodel = new Users_zhengjianshangchuan_gsModel();
        }
        $returnrray['xingxiangzhao'] = $findmodel['xingxiangzhao'] ?? '';
        $returnrray['shenfenzhengzhengmian'] = $findmodel['shenfenzhengzhengmian'] ?? '';
        $returnrray['shenfenzhengfanmian'] = $findmodel['shenfenzhengfanmian'] ?? '';
        $returnrray['jiangzhuang'] = $findmodel['jiangzhuang'] ?? '';
        $returnrray['jiehunzheng'] = $findmodel['jiehunzheng'] ?? '';

        $returnrray['jiashizheng'] = $findmodel['jiashizheng'] ?? '';
        $returnrray['zuzhijiegoudaimazhao'] = $findmodel['zuzhijiegoudaimazhao'] ?? '';
        $returnrray['yingyezhizhao'] = $findmodel['yingyezhizhao'] ?? '';
        $returnrray['shuiwudengjizheng'] = $findmodel['shuiwudengjizheng'] ?? '';
        $returnrray['zulinhetongzhao'] = $findmodel['zulinhetongzhao'] ?? '';

        $returnrray['geleixukezheng'] = $findmodel['geleixukezheng'] ?? '';
        $returnrray['geleirongyu'] = $findmodel['geleirongyu'] ?? '';
        $returnrray['fangchanzheng'] = $findmodel['fangchanzheng'] ?? '';

        /// print_r($returnrray);exit;
        //  $returnrray['shenfenzhengfanmian']='http://www.fuzhuangchangongxiao.cn/uploads/20191103/a16e46eab7aba28d7b53a5deb75cd67asmall.jpg';
        OA::Json(0, $returnrray);
    }

    /**
     * @apiGroup 用户 工厂信息
     * @api {post} /api/app/call/getusers_zhengjianshangchuan_gc 获取工厂证件上传的情况
     * @apiSuccess {string} xingxiangzhao 形象照
     * @apiSuccess {string} shenfenzhengzhengmian 身份证正面
     * @apiSuccess {string} shenfenzhengfanmian 身份证反面
     * @apiSuccess {string} jiangzhuang    奖状
     * @apiSuccess {string} jiehunzheng     结婚证
     *
     * @apiSuccess {string} jiashizheng 驾驶证
     * @apiSuccess {string} zuzhijiegoudaimazhao    组织结构代码照
     * @apiSuccess {string} yingyezhizhao 营业执照
     * @apiSuccess {string} shuiwudengjizheng 税务登记证
     * @apiSuccess {string} zulinhetongzhao 租赁合同照
     *
     * @apiSuccess {string} geleixukezheng 各类许可证
     * @apiSuccess {string} geleirongyu 各类荣誉
     * @apiSuccess {string} fangchanzheng 房产证
     * @apiSuccessExample 返回
     * {"code":0,"data":{"xingxiangzhao":null,"shenfenzhengzhengmian":null,"shenfenzhengfanmian":null,"jiangzhuang":null,"jiehunzheng":null,"jiashizheng":null,"zuzhijiegoudaimazhao":null,"yingyezhizhao":null,"shuiwudengjizheng":null,"zulinhetongzhao":null,"geleixukezheng":null,"geleirongyu":null,"fangchanzheng":null}}
     */
    public function getusers_zhengjianshangchuan_gc($post, $returnrray)
    {
        $findmodel = Users_zhengjianshangchuan_gcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->select([
            'xingxiangzhao',
            'shenfenzhengzhengmian',
            'shenfenzhengfanmian',
            'jiangzhuang',
            'jiehunzheng',

            'jiashizheng',
            'zuzhijiegoudaimazhao',
            'yingyezhizhao',
            'shuiwudengjizheng',
            'zulinhetongzhao',

            'geleixukezheng',
            'geleirongyu',
            'fangchanzheng',
        ])->one();
        if (!$findmodel) {
            $findmodel = new Users_zhengjianshangchuan_gcModel();
        }
        $returnrray['xingxiangzhao'] = $findmodel['xingxiangzhao']??"";
        $returnrray['shenfenzhengzhengmian'] = $findmodel['shenfenzhengzhengmian']??"";
        $returnrray['shenfenzhengfanmian'] = $findmodel['shenfenzhengfanmian']??"";
        $returnrray['jiangzhuang'] = $findmodel['jiangzhuang']??"";
        $returnrray['jiehunzheng'] = $findmodel['jiehunzheng']??"";

        $returnrray['jiashizheng'] = $findmodel['jiashizheng']??"";
        $returnrray['zuzhijiegoudaimazhao'] = $findmodel['zuzhijiegoudaimazhao']??"";
        $returnrray['yingyezhizhao'] = $findmodel['yingyezhizhao']??"";
        $returnrray['shuiwudengjizheng'] = $findmodel['shuiwudengjizheng']??"";
        $returnrray['zulinhetongzhao'] = $findmodel['zulinhetongzhao']??"";

        $returnrray['geleixukezheng'] = $findmodel['geleixukezheng']??"";
        $returnrray['geleirongyu'] = $findmodel['geleirongyu']??"";
        $returnrray['fangchanzheng'] = $findmodel['fangchanzheng']??"";

        /// print_r($returnrray);exit;
        //  $returnrray['shenfenzhengfanmian']='http://www.fuzhuangchangongxiao.cn/uploads/20191103/a16e46eab7aba28d7b53a5deb75cd67asmall.jpg';
        OA::Json(0, $returnrray);
    }


    /**
     * @apiGroup 用户 个人求职
     * @api {post} /api/app/call/getusers_zhengjianshangchuan_gr 获取个人证件上传的情况
     * @apiSuccess {string|NULL} benren 本人
     * @apiSuccess {string|NULL} shenfenzhengzhengmian 身份证正面
     * @apiSuccess {string|NULL} shenfenzhengfanmian 身份证反面
     * @apiSuccess {string|NULL} biyezheng    毕业证
     * @apiSuccess {string|NULL} jiangzhuangzhao     奖状照
     *
     * @apiSuccess {string|NULL} jiehunzheng 结婚证
     * @apiSuccess {string|NULL} jiashizheng 驾驶证
     * @apiSuccessExample 返回
     * {"code":0,"data":{"xingxiangzhao":null,"shenfenzhengzhengmian":null,"shenfenzhengfanmian":null,"jiangzhuang":null,"jiehunzheng":null,"jiashizheng":null,"zuzhijiegoudaimazhao":null,"yingyezhizhao":null,"shuiwudengjizheng":null,"zulinhetongzhao":null,"geleixukezheng":null,"geleirongyu":null,"fangchanzheng":null}}
     */
    public function getusers_zhengjianshangchuan_gr($post, $returnrray)
    {
        $returnrray = Users_zhengjianshangchuan_GrModel::getInfo([
            'benren', 'shenfenzhengzhengmian', 'shenfenzhengfanmian',
            'biyezheng', 'jiangzhuangzhao', 'jiehunzheng', 'jiashizheng'
        ]);
        OA::Json(0, $returnrray);
    }

    /**
     * @apiGroup 用户 个人求职
     * @api {post} /api/app/call/setusers_zhengjianshangchuan_gr 修改公司证件上传的情况
     * @apiParam {string|NULL} field 字段名,参考获取个人证件上传的情况
     * @apiParam {string|NULL} src 图片字符串
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function setusers_zhengjianshangchuan_gr($post, $returnrray)
    {
        $field = $post['field'];
        $src = $post['src'];
        $findmodel = Users_zhengjianshangchuan_GrModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->select([
            'id', $field
        ])->one();
        if (!$findmodel) {
            $findmodel = new Users_zhengjianshangchuan_GrModel;
            $findmodel->time = time();
            $findmodel->uid = Yii::$app->user->getId();
        }
        $findmodel[$field] = $src;
        if ($findmodel->save() === false) {
            OA::Json(1, '保存错误');
        } else {
            UsersBaseinfoGr::setIS('iszhengjian');
            OA::Json(0, 'ok');
        }
    }


    /**
     * @apiGroup 用户 公司信息
     * @api {post} /api/app/call/setusers_zhengjianshangchuan_gs 修改公司证件上传的情况
     * @apiParam {string|NULL} field 字段名,参考获取公司证件上传的情况返回的字段 可以替换成下面的字段,$去掉
     * @apiParam {string|NULL} src 图片字符串
     * @apiParam {field} $xingxiangzhao 形象照
     * @apiParam {field} $shenfenzhengzhengmian 身份证正面
     * @apiParam {field}  $shenfenzhengfanmian 身份证反面
     * @apiParam {field}  $jiangzhuang 奖状照
     * @apiParam {field}  $jiehunzheng 结婚证
     * @apiParam {field}  $jiashizheng 驾驶证
     * @apiParam {field}  $zuzhijiegoudaimazhao 组织结构代码照
     * @apiParam {field}  $yingyezhizhao 营业执照
     * @apiParam {field}  $shuiwudengjizheng 税务登记证
     * @apiParam {field}  $zulinhetongzhao 租赁合同照
     * @apiParam {field}  $geleixukezheng 各类许可证
     * @apiParam {field}  $geleirongyu 各类荣誉
     * @apiParam {field}  $fangchanzheng 房产证
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function setusers_zhengjianshangchuan_gs($post, $returnrray)
    {
        $field = $post['field'];
        $src = $post['src'];
        $findmodel = Users_zhengjianshangchuan_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->select([
            'id', $field
        ])->one();
        if (!$findmodel) {
            $findmodel = new Users_zhengjianshangchuan_gsModel;
            $findmodel->time = time();
            $findmodel->uid = Yii::$app->user->getId();
        }
        $findmodel[$field] = $src;
        if ($findmodel->save() === false) {
            OA::Json(1, '保存错误');
        } else {
            UsersBaseinfoGs::setIS('iszhengjian');
            OA::Json(0, 'ok');
        }
    }


    /**
     * @apiGroup 用户 工厂信息
     * @api {post} /api/app/call/setusers_zhengjianshangchuan_gc 修改工厂证件上传的情况
     * @apiParam {string|NULL} field 字段名,参考获取公司证件上传的情况返回的字段
     * @apiParam {string|NULL} src 图片字符串
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function setusers_zhengjianshangchuan_gc($post, $returnrray)
    {
        $field = $post['field'];
        $src = $post['src'];
        $findmodel = Users_zhengjianshangchuan_gcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->select([
            'id', $field
        ])->one();
        if (!$findmodel) {
            $findmodel = new Users_zhengjianshangchuan_gcModel;
            $findmodel->time = time();
            $findmodel->uid = Yii::$app->user->getId();
        }
        $findmodel[$field] = $src;
        if ($findmodel->save() === false) {
            OA::Json(1, '保存错误');
        } else {
            UsersBaseinfoGc::setIS('iszhengjian');
            OA::Json(0, 'ok');
        }
    }


    /**
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/getusers_basechanpin_gs 获取公司产品
     * @apiSuccess {string|NULL} chanpin 产品
     * @apiSuccess {string|NULL} zhenzhileidefault 政治类默认列表,分割
     * @apiSuccess {string|NULL} suozhileidefault 梭织类默认列表,分割
     * @apiSuccess {string|NULL} zhenzhilei 用户选择的针织类,分割
     * @apiSuccess {string|NULL} suozhilei 用户选择的梭织类,分割
     * @apiSuccessExample 返回
     * {"code":0,"data":{"chanpin":"\u5973\u88c5","zhenzhileidefault":"\u9488\u7ec7\u5e3d,\u56f4\u5dfe,\u624b\u5957,\u62ab\u5dfe,\u5185\u8863,\u5185\u88e4,\u5957\u88c5,\u6bdb\u8863,\u5916\u5957,\u6253\u5e95\u88e4,\u9488\u7ec7\u886b,\u88d9\u5b50,\u8fd0\u52a8\u670d,\u8fd0\u52a8\u88e4,\u7761\u8863,\u7761\u88e4,\u77ed\u88e4,\u889c\u5b50,\u7a97\u5e18,\u5e8a\u4e0a\u7528\u54c1,\u684c\u5e03,\u684c\u5e03","suozhileidefault":"\u7fbd\u7ed2\u670d,\u7fbd\u7ed2\u88e4,\u53cc\u9762\u5c3c,\u5355\u9762\u5c3c,\u7f8a\u6bdb\u5927\u8863,\u5939\u514b,\u5916\u5957","zhenzhilei":"\u88d9\u5b50","suozhilei":"\u53cc\u9762\u5c3c"}}
     */
    public function getusers_basechanpin_gs($post, $returnrray)
    {
        $chanpinStr = '';
        $zhenzhileiStr = '';
        $suozhileiStr = '';
        $zhenzhileiList = '针织帽,围巾,手套,披巾,内衣,内裤,套装,毛衣,外套,打底裤,针织衫,裙子,运动服,运动裤,睡衣,睡裤,短裤,袜子,窗帘,床上用品,桌布,桌布';

        $suozhileiList = '羽绒服,羽绒裤,双面尼,单面尼,羊毛大衣,夹克,外套';

        $one = User_basechanpin_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if ($one) {
            $chanpinStr = $one->chanpin;
            $zhenzhileiStr = $one->zhenzhilei;
            $suozhileiStr = $one->suozhilei;
        }
        $returnrray['chanpin'] = $chanpinStr;
        $returnrray['zhenzhileidefault'] = $zhenzhileiList;
        $returnrray['suozhileidefault'] = $suozhileiList;
        $returnrray['zhenzhilei'] = $zhenzhileiStr;
        $returnrray['suozhilei'] = $suozhileiStr;
        OA::Json(0, $returnrray);
    }


    /**
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/getusers_basechanpin_gc 获取工厂产品
     * @apiSuccess {string} chanpin 产品
     * @apiSuccess {Array} chanpindefault 产品数组范围
     * @apiSuccess {Array} zhenzhileidefault 政治类默认列表
     * @apiSuccess {Array} suozhileidefault 梭织类默认列表
     * @apiSuccess {Array} zhenzhilei 用户选择的针织类
     * @apiSuccess {Array} suozhilei 用户选择的梭织类
     * @apiSuccessExample 返回
{"code":0,"data":{"chanpindefault":["\u7537\u88c5","\u5973\u88c5","\u7ae5\u88c5"],"chanpin":"\u7ae5\u88c5","zhenzhileidefault":["\u9488\u7ec7\u5e3d","\u56f4\u5dfe","\u624b\u5957","\u62ab\u5dfe","\u5185\u8863","\u5185\u88e4","\u5957\u88c5","\u6bdb\u8863","\u5916\u5957","\u6253\u5e95\u88e4","\u9488\u7ec7\u886b","\u88d9\u5b50","\u8fd0\u52a8\u670d","\u8fd0\u52a8\u88e4","\u7761\u8863","\u7761\u88e4","\u77ed\u88e4","\u889c\u5b50","\u7a97\u5e18","\u5e8a\u4e0a\u7528\u54c1","\u684c\u5e03","\u684c\u5e03"],"suozhileidefault":["\u7fbd\u7ed2\u670d","\u7fbd\u7ed2\u88e4","\u53cc\u9762\u5c3c","\u5355\u9762\u5c3c","\u7f8a\u6bdb\u5927\u8863","\u5939\u514b","\u5916\u5957"],"zhenzhilei":["\u7a97\u5e18","\u5e8a\u4e0a\u7528\u54c1"],"suozhilei":["\u7fbd\u7ed2\u88e4"]}}
     */
    public function getusers_basechanpin_gc($post, $returnrray)
    {

        $chanpinStr = '';
        $zhenzhileiStr = '';
        $suozhileiStr = '';
        $zhenzhileiList = '针织帽,围巾,手套,披巾,内衣,内裤,套装,毛衣,外套,打底裤,针织衫,裙子,运动服,运动裤,睡衣,睡裤,短裤,袜子,窗帘,床上用品,桌布,桌布';

        $suozhileiList = '羽绒服,羽绒裤,双面尼,单面尼,羊毛大衣,夹克,外套';

        $one = User_basechanpin_gcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if ($one) {
            $chanpinStr = $one->chanpin;
            $zhenzhileiStr = $one->zhenzhilei;
            $suozhileiStr = $one->suozhilei;
        }
        $returnrray['chanpindefault'] = ['男装','女装','童装'];
        $returnrray['chanpin'] = $chanpinStr;
        $returnrray['zhenzhileidefault'] = Fun::strtoArray($zhenzhileiList);
        $returnrray['suozhileidefault'] = Fun::strtoArray($suozhileiList);
        $returnrray['zhenzhilei'] =  Fun::strtoArray($zhenzhileiStr);
        $returnrray['suozhilei'] = Fun::strtoArray($suozhileiStr);
        OA::Json(0, $returnrray);
    }


    /**
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/setusers_basechanpin_gs 设置公司产品
     * @apiParam {string} chanpin 产品
     * @apiParam {string} zhenzhilei 用户选择的针织类,分割
     * @apiParam {strin} suozhilei 用户选择的梭织类,分割
     * @apiSuccessExample 返回
     *
     * {"code":0,"data":"ok"}
     *
     */
    public function setusers_basechanpin_gs($post, $returnrray)
    {
        $one = User_basechanpin_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$one) {
            $one = new User_basechanpin_gsModel;
            $one->uid = Yii::$app->user->getId();
            $one->time = time();
            $one->fengge = '';
        }
        $one->chanpin = $post['chanpin'];
        $one->zhenzhilei = $post['zhenzhilei'];
        $one->suozhilei = $post['suozhilei'];
        if ($one->save() !== false) {
            UsersBaseinfoGs::setIS('isgongsichanpin');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }

    /**
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/setusers_basechanpin_gc 设置工厂产品
     * @apiParam {string} chanpin 产品
     * @apiParam {string} zhenzhilei 用户选择的针织类,分割
     * @apiParam {strin} suozhilei 用户选择的梭织类,分割
     * @apiSuccessExample 返回
     *
     * {"code":0,"data":"ok"}
     *
     */
    public function setusers_basechanpin_gc($post, $returnrray)
    {
        $one = User_basechanpin_gcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$one) {
            $one = new User_basechanpin_gcModel;
            $one->uid = Yii::$app->user->getId();
            $one->time = time();
            $one->fengge = '';
        }
        $one->chanpin = $post['chanpin'];
        $one->zhenzhilei = $post['zhenzhilei'];
        $one->suozhilei = $post['suozhilei'];
        if ($one->save() !== false) {
            UsersBaseinfoGc::setIS('isgongchangchanpin');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }











    /**
     *获取产品风格
     */
    /**
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/getusers_basechanpinfengge_gs 获取产品风格
     * @apiSuccess {array} fenggelist 风格列表
     * @apiSuccess {string} fenggelist.text] 风格名称
     * @apiSuccess {bool} fenggelist.on 是否选择
     * @apiSuccessExample 返回
     *
     * {"code":0,"data":{"fenggelist":[{"text":"\u745e\u4e3d","on":false},{"text":"\u751c\u871c","on":false},{"text":"\u6dd1\u5973","on":false},{"text":"\u540d\u5a9b","on":false},{"text":"\u6e05\u6670","on":false},{"text":"\u7530\u56ed","on":false},{"text":"\u4f11\u95f2","on":false},{"text":"\u8fd0\u52a8","on":false},{"text":"\u4e2d\u6027","on":false},{"text":"\u6253\u5e95\u88e4","on":false},{"text":"\u6253\u5e95\u88e4","on":false},{"text":"\u6b27\u7f8e","on":false},{"text":"\u8857\u5934","on":false},{"text":"\u670b\u514b","on":false},{"text":"\u5b66\u9662","on":false},{"text":"\u82f1\u4f26","on":false},{"text":"\u6c11\u65cf","on":false},{"text":"\u590d\u53e4","on":false},{"text":"\u4e2d\u56fd\u98ce","on":false}]}}
     *
     */
    public function getusers_basechanpinfengge_gs($post, $returnrray)
    {

        $fengge = '';
        $one = User_basechanpin_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if ($one) {
            $fengge = $one->fengge;
        }
        $list = explode(",", $fengge);
        $fenggelist = [
            [
                'text' => '瑞丽'
            ],
            [
                'text' => '甜蜜'
            ],

            [
                'text' => '淑女'
            ],
            [
                'text' => '名媛'
            ],

            [
                'text' => '清晰'
            ],
            [
                'text' => '田园'
            ],

            [
                'text' => '休闲'
            ],

            [
                'text' => '运动'
            ],

            [
                'text' => '中性'
            ],
            [
                'text' => '打底裤'
            ],

            [
                'text' => '打底裤'
            ],
            [
                'text' => '欧美'
            ],

            [
                'text' => '街头'
            ],
            [
                'text' => '朋克'
            ],
            [
                'text' => '学院'
            ],

            [
                'text' => '英伦'
            ],
            [
                'text' => '民族'
            ],
            [
                'text' => '复古'
            ],
            [
                'text' => '中国风'
            ]
        ];
        foreach ($fenggelist as $k => $v) {
            if (in_array($v['text'], $list)) {
                $fenggelist[$k]['on'] = true;
            } else {
                $fenggelist[$k]['on'] = false;
            }
        }
        $returnrray['fenggelist'] = $fenggelist;
        OA::Json(0, $returnrray);
    }


    /**
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/setgongchangshebei_gc 修改工厂设备信息
     * @apiParam {string} pinpai 数组转换为字符串,具体格式参考 获取工厂设备信息 接口返回的格式
     * @apiSuccessExample 返回
     *{"code":0,"data":"ok"}
     */
    public function setgongchangshebei_gc($post, $returnrray)
    {
        $one = UserShebeiGcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$one) {
            $one = new UserShebeiGcModel;
            $one->uid = Yii::$app->user->getId();
        }
        $one->shebei = $post['shebei'];
        if ($one->save() !== false) {

            UsersBaseinfoGc::setIS('isgongchangshebei');
            API::echo_json(0, 'ok');
        } else {
            API::echo_json(1, '系统错误');
        }
    }

    /**
     *获取产品风格
     */
    /**
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/getgongchangshebei_gc 获取工厂设备信息
     * @apiSuccess {array} shebeilist 设备列表数组
     * @apiSuccess {bool} shebeilist.on 是否启用,如果是true,表示选择状态
     * @apiSuccess {string} shebeilist.pinpai 品牌名称,
     * @apiSuccess {int} shebeilist.nianxian 年限
     * @apiSuccess {int} shebeilist.num 数量
     * @apiSuccess {string} shebeilist.pic 图片,分割
     * @apiSuccessExample 返回
     *
     * {"code":0,"data":{"shebeilist":[{"on":false,"pinpai":"\u666e\u901a\u6a21\u5757\u673a","nianxian":"","num":"","pic":[]},{"on":true,"pinpai":"\u81ea\u52a8\u6a21\u5757\u673a","nianxian":23,"num":23,"pic":["http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20200405\/cbedf50fc875d2ef22c5fcc8e188a44fsmall.jpg","http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20191102\/74e638d3d11a2197e2a7997e3719ba57small.jpg","http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20200716\/5135a6cbdafb27e48466a3bf5af67e2dsmall.jpg"]},{"on":false,"pinpai":"\u7535\u8111\u5e73\u8f66","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u4e09\u7ebf\u62f7\u8fb9\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u56db\u7ebf\u62f7\u8fb9\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u4e94\u7ebf\u62f7\u8fb9\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u53cc\u9488\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u4e09\u89d2\u9488\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u7ef7\u7f1d\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u5c65\u5e26\u81ea\u52a8\u6d41\u6c34\u7ebf","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u666e\u901a\u6d41\u6c34\u7ebf","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u666e\u901a\u88c1\u5e8a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u81ea\u52a8\u88c1\u5e8a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u9a8c\u5e03\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u9489\u6263\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u5e73\u5934\u773c\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u5706\u5934\u773c\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u6572\u6263\u673a","nianxian":"","num":"","pic":[]},{"on":false,"pinpai":"\u70eb\u53f0","nianxian":"","num":"","pic":[]},{"on":true,"pinpai":"\u54c1\u724c\u540d\u79f01","nianxian":23,"num":23,"pic":["http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20200405\/cbedf50fc875d2ef22c5fcc8e188a44fsmall.jpg","http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20191102\/74e638d3d11a2197e2a7997e3719ba57small.jpg","http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20200716\/5135a6cbdafb27e48466a3bf5af67e2dsmall.jpg"]},{"on":true,"pinpai":"\u54c1\u724c\u540d\u79f03","nianxian":23,"num":23,"pic":["http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20200405\/cbedf50fc875d2ef22c5fcc8e188a44fsmall.jpg","http:\/\/www.fuzhuangchangongxiao.cn\/uploads\/20200717\/9ffd373afd235008b82c5b59a9f8a8f9small.jpg"]}]}}
     */
    public function getgongchangshebei_gc($post, $returnrray)
    {
        $list = [
            '普通模块机', '自动模块机', '电脑平车', '三线拷边机', '四线拷边机', '五线拷边机', '双针机', '三角针机', '绷缝机', '履带自动流水线', '普通流水线', '普通裁床', '自动裁床', '验布机', '钉扣机', '平头眼机', '圆头眼机', '敲扣机', '烫台'
        ];
        $shebeiList = [];
        $one = UserShebeiGcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if ($one && $one->shebei && $one->shebei != '') {
            $shebeiList = json_decode($one->shebei, true);
        }
        // print_r($shebeiList);exit;
        $cache = [];
        foreach ($shebeiList as $vo) {
            if (!in_array($vo['pinpai'], $list)) {
                $list[] = $vo['pinpai'];
            }
            $cache[$vo['pinpai']] = $vo;
        }
        $outlist = [];
        foreach ($list as $vo) {
            if (isset($cache[$vo])) {
                //$outlist[]=$cache[$vo];
                $pic = [];
                if ($cache[$vo]['pic'] && $cache[$vo]['pic'] != '') {
                    /// $pic = explode(',', $cache[$vo]['pic']);
                    $pic = $cache[$vo]['pic'];
                }
                $outlist[] = [
                    'on' => true,
                    'pinpai' => $vo,
                    'nianxian' => $cache[$vo]['nianxian'] ?? '',
                    'num' => $cache[$vo]['num'] ?? '',
                    'pic' => $pic,
                ];
            } else {
                $outlist[] = [
                    'on' => false,
                    'pinpai' => $vo,
                    'nianxian' => '',
                    'num' => '',
                    'pic' => [],
                ];
            }
        }
        $returnrray['shebeilist'] = $outlist;
        OA::Json(0, $returnrray);
        //print_r($list);exit;


        /*
        $list = [
            '普通模块机' => [], '自动模块机' => [], '电脑平车' => [],
            '三线拷边机' => [], '四线拷边机' => [], '五线拷边机' => [],
            '双针机' => [], '三角针机' => [], '绷缝机' => [],
            '履带自动流水线' => [], '普通流水线' => [], '普通裁床' => [],
            '自动裁床' => [], '验布机' => [], '钉扣机' => [],
            '平头眼机' => [], '圆头眼机' => [], '敲扣机' => [], '烫台' => []
        ];
        $p='';
        foreach ($list as $key=>$vo){
            $p.=',\''.$key.'\'';
        }
        echo $p;

        exit;
        $shebeiList = [];
        $one = UserShebeiGcModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if ($one && $one->shebei && $one->shebei != '') {
            $shebeiList = json_decode($one->shebei, true);
            foreach ($shebeiList as $k => $v) {
                $list[$k]=[];
            }
        }
        $shebeilist=[];
        foreach ($list as $k => $v) {
            if (isset($shebeiList[$k])) {
                $pic = [];
                if ($shebeiList[$k]['pic'] && $shebeiList[$k]['pic'] != '') {
                    $pic = explode(',', $shebeiList[$k]['pic']);
                }
                $list[$k] = [
                    'on' => true,
                    'pinpai' => $shebeiList[$k]['pinpai'] ?? '',
                    'nianxian' => $shebeiList[$k]['nianxian'] ?? '',
                    'num' => $shebeiList[$k]['num'] ?? '',
                    'pic' => $pic,
                ];
            } else {
                $list[$k] = [
                    'on' => false,
                    'pinpai' => '',
                    'nianxian' => '',
                    'num' => '',
                    'pic' => [],
                ];
            }
            $shebeilist[]=$list[$k];
        }
        $returnrray['shebeilist'] = $shebeilist;
        OA::Json(0, $returnrray);
        */
    }


    /**
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/setusers_basechanpinfengge_gs 设置公司产品风格
     * @apiParam {string} fengge 风格列表
     * @apiSuccessExample 返回
     *
     * {"code":0,"data":"ok"}
     */
    public function setusers_basechanpinfengge_gs($post, $returnrray)
    {
        $one = User_basechanpin_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$one) {
            $one = new User_basechanpin_gsModel;
            $one->uid = Yii::$app->user->getId();
            $one->time = time();
            $one->fengge = '';
            $one->chanpin = '';
            $one->zhenzhilei = '';
            $one->suozhilei = '';
        }
        $one->fengge = $post['fengge'];
        if ($one->save() !== false) {
            UsersBaseinfoGs::setIS('ischanpinfengge');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }


    /**
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/getusers_basezhiliangbiaozhun_gs 获取产品质量标准
     * @apiSuccess {array} zhiliangbiaozhun 质量标准
     * @apiSuccess {string} zhiliangbiaozhun.text 名称
     * @apiSuccess {bool} zhiliangbiaozhun.on 是否选项
     * @apiSuccessExample 返回
     *
     * {"code":0,"data":{"zhiliangbiaozhun":[{"text":"\u6309\u5de5\u827a\u5355","on":false},{"text":"\u5e73\u91cf","on":false},{"text":"\u5168\u68c0","on":false},{"text":"\u62bd\u68c0","on":false}]}}
     */
    public function getusers_basezhiliangbiaozhun_gs($post, $returnrray)
    {
        $zhiliangbiaozhun = '';
        $one = User_basechanpin_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if ($one) {
            $zhiliangbiaozhun = $one->zhiliangbiaozhun;
        }
        $list = explode(",", $zhiliangbiaozhun);
        $zhiliangbiaozhunlist = [
            [
                'text' => '按工艺单'
            ],
            [
                'text' => '平量'
            ],
            [
                'text' => '全检'
            ],
            [
                'text' => '抽检'
            ]
        ];
        foreach ($zhiliangbiaozhunlist as $k => $v) {
            if (in_array($v['text'], $list)) {
                $zhiliangbiaozhunlist[$k]['on'] = true;
            } else {
                $zhiliangbiaozhunlist[$k]['on'] = false;
            }
        }
        $returnrray['zhiliangbiaozhun'] = $zhiliangbiaozhunlist;
        OA::Json(0, $returnrray);
    }


    /**
     *
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/setusers_basezhiliangbiaozhun_gs 设置公司产品质量标准
     * @apiParam {string} zhiliangbiaozhun 质量标准,分割
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function setusers_basezhiliangbiaozhun_gs($post, $returnrray)
    {
        $one = User_basechanpin_gsModel::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$one) {
            $one = new User_basechanpin_gsModel;
            $one->uid = Yii::$app->user->getId();
            $one->time = time();
            $one->fengge = '';
            $one->chanpin = '';
            $one->zhenzhilei = '';
            $one->suozhilei = '';
            $one->zhiliangbiaozhun = '';
        }
        $one->zhiliangbiaozhun = $post['zhiliangbiaozhun'];
        if ($one->save() !== false) {
            UsersBaseinfoGs::setIS('iszhiliangbiaozhun');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }


    private function explode($de, $field)
    {
        if (empty($field)) {
            return [];
        }
        return explode($de, $field);
    }

    /**
     *
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/getusers_gongsihuanjing_gs 获取公司环境照片
     * @apiSuccess {array} zongjingban 总经办 数组
     * @apiSuccess {array} xiaoshoubu 销售部 数组
     * @apiSuccess {array} zhaoshangbu 招商部 数组
     *
     * @apiSuccess {array} dianshangbu 电商部 数组
     * @apiSuccess {array} shejibu 设计部 数组
     * @apiSuccess {array} jishubu 技术部 数组
     *
     * @apiSuccess {array} caigoubu 采购部 数组
     * @apiSuccess {array} shengchanbu 生产部 数组
     * @apiSuccess {array} waifabu 外发部 数组
     *
     * @apiSuccess {array} caiwubu 财务部 数组
     * @apiSuccess {array} xingzhengbu 行政部 数组
     * @apiSuccess {array} renshibu 人事部 数组
     *
     * @apiSuccess {array} pinkongbu 品控部 数组
     * @apiSuccess {array} wuliubu 物流部 数组
     * @apiSuccess {array} cangchubu 仓储部 数组
     *
     * @apiSuccess {array} huiyishi 会议室 数组
     * @apiSuccess {array} zhanshiting 展示厅 数组
     * @apiSuccessExample 返回
     * {"code":0,"data":{"zongjingban":[],"xiaoshoubu":[],"zhaoshangbu":[],"dianshangbu":[],"shejibu":[],"jishubu":[],"caigoubu":[],"shengchanbu":[],"waifabu":[],"caiwubu":[],"xingzhengbu":[],"renshibu":[],"pinkongbu":[],"wuliubu":[],"cangchubu":[],"huiyishi":[],"zhanshiting":[]}}
     */
    public function getusers_gongsihuanjing_gs($post, $returnrray)
    {
        $one = UsersHuanjingGs::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if ($one) {
            $returnrray['zongjingban'] = $this->explode(",", $one->zongjingban);
            $returnrray['xiaoshoubu'] = $this->explode(",", $one->xiaoshoubu);
            $returnrray['zhaoshangbu'] = $this->explode(",", $one->zhaoshangbu);

            $returnrray['dianshangbu'] = $this->explode(",", $one->dianshangbu);
            $returnrray['shejibu'] = $this->explode(",", $one->shejibu);
            $returnrray['jishubu'] = $this->explode(",", $one->jishubu);

            $returnrray['caigoubu'] = $this->explode(",", $one->caigoubu);
            $returnrray['shengchanbu'] = $this->explode(",", $one->shengchanbu);
            $returnrray['waifabu'] = $this->explode(",", $one->waifabu);

            $returnrray['caiwubu'] = $this->explode(",", $one->caiwubu);
            $returnrray['xingzhengbu'] = $this->explode(",", $one->xingzhengbu);
            $returnrray['renshibu'] = $this->explode(",", $one->renshibu);

            $returnrray['pinkongbu'] = $this->explode(",", $one->pinkongbu);
            $returnrray['wuliubu'] = $this->explode(",", $one->wuliubu);
            $returnrray['cangchubu'] = $this->explode(",", $one->cangchubu);

            $returnrray['huiyishi'] = $this->explode(",", $one->huiyishi);
            $returnrray['zhanshiting'] = $this->explode(",", $one->zhanshiting);

        } else {
            $returnrray['zongjingban'] = [];
            $returnrray['xiaoshoubu'] = [];
            $returnrray['zhaoshangbu'] = [];

            $returnrray['dianshangbu'] = [];
            $returnrray['shejibu'] = [];
            $returnrray['jishubu'] = [];

            $returnrray['caigoubu'] = [];
            $returnrray['shengchanbu'] = [];
            $returnrray['waifabu'] = [];

            $returnrray['caiwubu'] = [];
            $returnrray['xingzhengbu'] = [];
            $returnrray['renshibu'] = [];

            $returnrray['pinkongbu'] = [];
            $returnrray['wuliubu'] = [];
            $returnrray['cangchubu'] = [];

            $returnrray['huiyishi'] = [];
            $returnrray['zhanshiting'] = [];
        }

        OA::Json(0, $returnrray);
    }


    /**
     *
     * @apiGroup  用户 公司信息
     * @api {post} /api/app/call/setusers_gongsihuanjing_gs 设置公司环境照片
     * @apiParam {array} zongjingban 总经办 数组
     * @apiParam {array} xiaoshoubu 销售部 数组
     * @apiParam {array} zhaoshangbu 招商部 数组
     *
     * @apiParam {array} dianshangbu 电商部 数组
     * @apiParam {array} shejibu 设计部 数组
     * @apiParam {array} jishubu 技术部 数组
     *
     * @apiParam {array} caigoubu 采购部 数组
     * @apiParam {array} shengchanbu 生产部 数组
     * @apiParam {array} waifabu 外发部 数组
     *
     * @apiParam {array} caiwubu 财务部 数组
     * @apiParam {array} xingzhengbu 行政部 数组
     * @apiParam {array} renshibu 人事部 数组
     *
     * @apiParam {array} pinkongbu 品控部 数组
     * @apiParam {array} wuliubu 物流部 数组
     * @apiParam {array} cangchubu 仓储部 数组
     *
     * @apiParam {array} huiyishi 会议室 数组
     * @apiParam {array} zhanshiting 展示厅 数组
     *
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function setusers_gongsihuanjing_gs($post)
    {
        $one = UsersHuanjingGs::find()->where([
            'uid' => Yii::$app->user->getId()
        ])->one();
        if (!$one) {
            $one = new UsersHuanjingGs;
            $one->uid = Yii::$app->user->getId();
            $one->time = time();
            $one->zongjingban = '';
            $one->xiaoshoubu = '';
            $one->zhaoshangbu = '';

            $one->dianshangbu = '';
            $one->shejibu = '';
            $one->jishubu = '';

            $one->caigoubu = '';
            $one->shengchanbu = '';
            $one->waifabu = '';

            $one->caiwubu = '';
            $one->xingzhengbu = '';
            $one->renshibu = '';

            $one->pinkongbu = '';
            $one->wuliubu = '';
            $one->cangchubu = '';

            $one->huiyishi = '';
            $one->zhanshiting = '';
        } else {
            $one->zongjingban = $post['zongjingban'];
            $one->xiaoshoubu = $post['xiaoshoubu'];
            $one->zhaoshangbu = $post['zhaoshangbu'];

            $one->dianshangbu = $post['dianshangbu'];
            $one->shejibu = $post['shejibu'];
            $one->jishubu = $post['jishubu'];

            $one->caigoubu = $post['caigoubu'];
            $one->shengchanbu = $post['shengchanbu'];
            $one->waifabu = $post['waifabu'];

            $one->caiwubu = $post['caiwubu'];
            $one->xingzhengbu = $post['xingzhengbu'];
            $one->renshibu = $post['renshibu'];

            $one->pinkongbu = $post['pinkongbu'];
            $one->wuliubu = $post['wuliubu'];
            $one->cangchubu = $post['cangchubu'];

            $one->huiyishi = $post['huiyishi'];
            $one->zhanshiting = $post['zhanshiting'];
        }
        if ($one->save() !== false) {
            UsersBaseinfoGs::setIS('isgongsihuanjing');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }


    /**
     *
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/getusers_chanliangchanneng_gc 获取工厂产量产能
     * @apiSuccess {int} caijian    裁剪
     * @apiSuccess {int} zhengjian  整件
     * @apiSuccess {int} kunbaoliu  捆包流
     * @apiSuccess {int} danjianliu 单件流
     * @apiSuccess {int} zongrenshu 全厂总人数
     * @apiSuccess {int} richanliang  1={0-500} 2={501-2000} 3={2001-5000} 4={5001-20000} 5={20001-50000} 100={大于50000}
     *
     * @apiSuccessExample 返回
     * {"code":0,"data":{"caijian":null,"zhengjian":null,"kunbaoliu":null,"danjianliu":null,"zongrenshu":null,"richanliang":null}}
     */
    public function getusers_chanliangchanneng_gc($post)
    {
        API::echo_json(0, ChanliangchannengGcModel::getInfo([
            'caijian', 'zhengjian', 'kunbaoliu', 'danjianliu', 'danjianliu', 'zongrenshu', 'richanliang'
        ]));
    }

    /**
     *
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/setusers_chanliangchanneng_gc 修改工厂产量产能
     * @apiParam {int} caijian    裁剪
     * @apiParam {int} zhengjian  整件
     * @apiParam {int} kunbaoliu  捆包流
     * @apiParam {int} danjianliu 单件流
     * @apiParam {int} zongrenshu 全厂总人数
     * @apiParam {int} richanliang  1={0-500} 2={501-2000} 3={2001-5000} 4={5001-20000} 5={20001-50000} 100={大于50000}
     *
     * @apiSuccessExample 返回
     *{"code":0,"data":"ok"}
     */
    public function setusers_chanliangchanneng_gc($post)
    {
        UsersBaseinfoGc::setIS('ischanpinchanneng');
        API::echo_json(0, ChanliangchannengGcModel::setInfo([
            'caijian', 'zhengjian', 'kunbaoliu', 'danjianliu', 'danjianliu', 'zongrenshu', 'richanliang'
        ], $post));
    }


    /**
     *
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/getusers_zhiliangyaoqiu_gc 获取工厂质量要求
     * @apiSuccess {string} shichanghuo 市场货 4个01组成的字符串,1000表示一道,0100表示二道,1100表示一道和二道并存,1111表示一道二道三道四道并存
     * @apiSuccess {string} banjingpin  半精品 含义同上
     * @apiSuccess {string} quanjingpin  全精品 含义同上
     * @apiSuccess {string} waixiao  外销 含义同上
     * @apiSuccess {string} neixiao  内销 含义同上
     * @apiSuccess {int} zujian  组检 如果用户没有填写过,为null
     * @apiSuccess {int} weicha  尾查
     * @apiSuccess {int} xunjian  巡检
     * @apiSuccessExample 返回
     *{"code":0,"data":{"shichanghuo":"0000","banjingpin":"0000","quanjingpin":"0000","waixiao":"0000","neixiao":"0000","zujian":null,"weicha":null,"xunjian":null}}
     */
    public function getusers_zhiliangyaoqiu_gc($post)
    {
        /* var_dump(decbin(123));
         var_dump(base_convert('123',10,2));

         exit;*/
        $one = UserZhiliangyaoqiuGc::getInfo([
            'shichanghuo', 'banjingpin', 'quanjingpin', 'waixiao', 'neixiao', 'zujian', 'weicha', 'xunjian']);
        $one['shichanghuo'] = $this->vert($one['shichanghuo']);
        $one['banjingpin'] = $this->vert($one['banjingpin']);
        $one['quanjingpin'] = $this->vert($one['quanjingpin']);
        $one['waixiao'] = $this->vert($one['waixiao']);
        $one['neixiao'] = $this->vert($one['neixiao']);
        API::echo_json(0, $one);
    }

    /**
     * 转换为二进制字符串
     */
    private function vert($val)
    {
        if (!$val) {
            return '0000';
        } else {
            return str_pad(base_convert($val, 10, 2), 4, 0, STR_PAD_LEFT);
        }
    }

    /**
     * 二进制字符串转换为十进制数字
     */
    private function vertdecimal($val)
    {
        return base_convert($val, 2, 10);
    }

    /**
     *
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/setusers_zhiliangyaoqiu_gc 修改工厂质量要求
     * @apiParam {string} shichanghuo 市场货 4个01组成的字符串,1000表示一道,0100表示二道,1100表示一道和二道并存,1111表示一道二道三道四道并存
     * @apiParam {string} banjingpin  半精品 含义同上
     * @apiParam {string} quanjingpin  全精品 含义同上
     * @apiParam {string} waixiao  外销 含义同上
     * @apiParam {string} neixiao  内销 含义同上
     * @apiParam {int} zujian  组检 如果用户没有填写过,为null
     * @apiParam {int} weicha  尾查
     * @apiParam {int} xunjian  巡检
     * @apiSuccessExample 返回
     *{"code":0,"data":{"ok"}}
     */
    public function setusers_zhiliangyaoqiu_gc($post)
    {

        $post['shichanghuo'] = $this->vertdecimal($post['shichanghuo']);
        $post['banjingpin'] = $this->vertdecimal($post['banjingpin']);
        $post['quanjingpin'] = $this->vertdecimal($post['quanjingpin']);
        $post['waixiao'] = $this->vertdecimal($post['waixiao']);
        $post['neixiao'] = $this->vertdecimal($post['neixiao']);
        // print_r($post);exit;
        UsersBaseinfoGc::setIS('iszhiliangyaoqiu');
        API::echo_json(0, UserZhiliangyaoqiuGc::setInfo([
            'shichanghuo', 'banjingpin', 'quanjingpin',
            'waixiao', 'neixiao', 'zujian', 'weicha', 'xunjian'
        ], $post));
    }


    /**
     *
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/getusers_gongsihuanjing_gs 获取工厂环境照片
     * @apiSuccess {array} menweitu 门卫图片 数组
     * @apiSuccess {array} chagnfangwaixingtu 厂房外形图片 数组
     * @apiSuccess {array} chongrongfangtu 充绒房图片 数组
     *
     * @apiSuccess {array} jishubutu 技术部图片 数组
     * @apiSuccess {array} fengzhichejian 缝制车间图片 数组
     * @apiSuccess {array} houdaochejian 后道车间图片 数组
     *
     * @apiSuccess {array} caijianchejian 裁剪车间图片 数组
     * @apiSuccess {array} yangyijian 样衣间图片 数组
     *
     * @apiSuccessExample 返回
     * {"code":0,"data":{"zongjingban":[],"xiaoshoubu":[],"zhaoshangbu":[],"dianshangbu":[],"shejibu":[],"jishubu":[],"caigoubu":[],"shengchanbu":[],"waifabu":[],"caiwubu":[],"xingzhengbu":[],"renshibu":[],"pinkongbu":[],"wuliubu":[],"cangchubu":[],"huiyishi":[],"zhanshiting":[]}}
     */
    public function getusers_gongchanghuanjing_gc($post, $returnrray)
    {
        $returnrray = UsersHuanjingGc::getInfo([
            'menweitu', 'chagnfangwaixingtu', 'chongrongfangtu',
            'jishubutu', 'fengzhichejian', 'houdaochejian',
            'caijianchejian', 'yangyijian',
        ]);
        $returnrray['menweitu'] = $this->explode(",", $returnrray['menweitu']);
        $returnrray['chagnfangwaixingtu'] = $this->explode(",", $returnrray['chagnfangwaixingtu']);
        $returnrray['chongrongfangtu'] = $this->explode(",", $returnrray['chongrongfangtu']);

        $returnrray['jishubutu'] = $this->explode(",", $returnrray['jishubutu']);
        $returnrray['fengzhichejian'] = $this->explode(",", $returnrray['fengzhichejian']);
        $returnrray['houdaochejian'] = $this->explode(",", $returnrray['houdaochejian']);

        $returnrray['caijianchejian'] = $this->explode(",", $returnrray['caijianchejian']);
        $returnrray['yangyijian'] = $this->explode(",", $returnrray['yangyijian']);
        OA::Json(0, $returnrray);
        /* $one = UsersHuanjingGc::find()->where([
             'uid' => Yii::$app->user->getId()
         ])->one();
         if ($one) {
             $returnrray['menweitu'] = $this->explode(",", $one->menweitu);
             $returnrray['chagnfangwaixingtu'] = $this->explode(",", $one->chagnfangwaixingtu);
             $returnrray['chongrongfangtu'] = $this->explode(",", $one->chongrongfangtu);

             $returnrray['jishubutu'] = $this->explode(",", $one->jishubutu);
             $returnrray['fengzhichejian'] = $this->explode(",", $one->fengzhichejian);
             $returnrray['houdaochejian'] = $this->explode(",", $one->houdaochejian);

             $returnrray['caijianchejian'] = $this->explode(",", $one->caijianchejian);
             $returnrray['yangyijian'] = $this->explode(",", $one->yangyijian);

         } else {
             $returnrray['menweitu'] = [];
             $returnrray['chagnfangwaixingtu'] = [];
             $returnrray['chongrongfangtu'] = [];

             $returnrray['jishubutu'] = [];
             $returnrray['fengzhichejian'] = [];
             $returnrray['houdaochejian'] = [];

             $returnrray['caijianchejian'] = [];
             $returnrray['yangyijian'] = [];
         }*/


    }


    /**
     *
     * @apiGroup  用户 工厂信息
     * @api {post} /api/app/call/setusers_gongsihuanjing_gc 设置工厂环境照片
     * @apiParam {array} menweitu 门卫图片 数组
     * @apiParam {array} chagnfangwaixingtu 厂房外形图片 数组
     * @apiParam {array} chongrongfangtu 充绒房图片 数组
     *
     * @apiParam {array} jishubutu 技术部图片 数组
     * @apiParam {array} fengzhichejian 缝制车间图片 数组
     * @apiParam {array} houdaochejian 后道车间图片 数组
     *
     * @apiParam {array} caijianchejian 裁剪车间图片 数组
     * @apiParam {array} yangyijian 样衣间图片 数组
     *
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function setusers_gongchanghuanjing_gc($post)
    {
        ;
        if (UsersHuanjingGc::setInfo([
            'menweitu', 'chagnfangwaixingtu', 'chongrongfangtu',
            'jishubutu', 'fengzhichejian', 'houdaochejian',
            'caijianchejian', 'yangyijian',
        ], $post)) {
            UsersBaseinfoGc::setIS('isgongchanghuanjing');
            OA::Json(0, 'ok');
        } else {
            OA::Json(1, '保存错误');
        }
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/getuser_jiaoyubeijing_gr 获取教育背景
     * @apiSuccess {array} jiaoyubeijingarray   教育背景数组
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function getuser_jiaoyubeijing_gr($post)
    {
        $out = UserOtherinfoGr::getInfo([
            'jiaoyubeijingArray'
        ]);
        if ($out['jiaoyubeijingArray']) {
            $out['jiaoyubeijingArray'] = json_decode($out['jiaoyubeijingArray'], true);
        } else {
            $out['jiaoyubeijingArray'] = [];
        }
        API::echo_json(0, $out);
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/setuser_jiaoyubeijing_gr 修改教育背景
     * @apiParam {string} jiaoyubeijingarray   教育背景数组
     */
    public function setuser_jiaoyubeijing_gr($post)
    {
        $out = UserOtherinfoGr::setInfo([
            'jiaoyubeijingArray'
        ], $post);
        UsersBaseinfoGr::setIS('isjiaoyubeijing', 1);
        API::echo_json(0, $out);
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/getuser_gongzuojingli_gr 获取工作经历
     * @apiSuccess {array} gongzuojingliArray   获取工作经历数组
     * @apiSuccessExample 返回
     * {"code":0,"data":{"gongzuojingliArray":[{"title":"(\u5de5\u4f5c\u7ecf\u53861)","zhuanye":"aa","zhiwei":"bvb","lizhiyuanyin":"s","gangweizhineng":"c","xueli1":"2020-07-23","xueli2":"2020-07-23"}]}}
     */
    public function getuser_gongzuojingli_gr($post)
    {
        $out = UserOtherinfoGr::getInfo([
            'gongzuojingliArray'
        ]);
        if ($out['gongzuojingliArray']) {
            $out['gongzuojingliArray'] = json_decode($out['gongzuojingliArray'], true);
        } else {
            $out['gongzuojingliArray'] = [];
        }
        API::echo_json(0, $out);
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/setuser_gongzuojingli_gr 修改工作经历
     * @apiParam {string} gongzuojingliArray   工作经历数组
     * @apiSuccessExample 例子
     *  [{"title":"(工作经历1)","zhuanye":"aa","zhiwei":"bvb","lizhiyuanyin":"s","gangweizhineng":"c","xueli1":"2020-07-23","xueli2":"2020-07-23"}]
     */
    public function setuser_gongzuojingli_gr($post)
    {
        $out = UserOtherinfoGr::setInfo([
            'gongzuojingliArray'
        ], $post);
        UsersBaseinfoGr::setIS('isgongzuojingli', 1);
        API::echo_json(0, $out);
    }


    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/getuser_jiatingchengyuan_gr 获取家庭成员
     * @apiSuccess {array} gongzuojingliArray   获取家庭成员数组
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function getuser_jiatingchengyuan_gr($post)
    {
        $out = UserOtherinfoGr::getInfo([
            'jiatingchengyuanArray'
        ]);
        if ($out['jiatingchengyuanArray']) {
            $out['jiatingchengyuanArray'] = json_decode($out['jiatingchengyuanArray'], true);
        } else {
            $out['jiatingchengyuanArray'] = [];
        }
        API::echo_json(0, $out);
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/setuser_jiatingchengyuan_gr 修改家庭成员
     * @apiParam {string} jiaoyubeijingarray   家庭成员数组
     */
    public function setuser_jiatingchengyuan_gr($post)
    {
        $out = UserOtherinfoGr::setInfo([
            'jiatingchengyuanArray'
        ], $post);
        UsersBaseinfoGr::setIS('isjiatingchengyuan', 1);
        API::echo_json(0, $out);
    }


    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/getuser_qiuzhiyixiang_gr 获取求职意向信息公司
     * @apiSuccess {array} qiuzhiyixiangArrayGS   求职意向数组
     * @apiSuccess {string} qiuzhiyixiangArrayGS.didian   地点 省市县用空格分隔
     * @apiSuccess {string} qiuzhiyixiangArrayGS.zhiwei  职位
     * @apiSuccess {string} qiuzhiyixiangArrayGS.qiwangxinshui   期望薪水
     * @apiSuccess {string} qiuzhiyixiangArrayGS.gongzuoleixing   工作类型
     * @apiSuccess {string} qiuzhiyixiangArrayGS.hangye   行业
     * @apiSuccess {string} qiuzhiyixiangArrayGS.daogangshijian   到岗时间
     *
     * * @apiSuccessExample 返回
     *
     *
     *
     * {"code":0,"data":{"qiuzhiyixiangArrayGS":[{"title":"(\u6c42\u804c\u610f\u54111)","didian":"\u5929\u6d25\u5e02 \u5929\u6d25\u5e02 \u548c\u5e73\u533a","zhiwei":"a","qiwangxinshui":"6","gongzuoleixing":"bb","hangye":"vv","daogangshijian":"cc"}]}}
     *  其中期望薪水对应类型
     *  <option value="">请选择</option>
     * <option value="1">1000元~2000元</option>
     * <option value="2">2000元~5000元</option>
     * <option value="3">5000元~10000元</option>
     * <option value="4">10000元~15000元</option>
     * <option value="5">15000元~30000元</option>
     * <option value="6">30000元以上</option>
     *
     *
     */
    public function getuser_qiuzhiyixiang_gr($post)
    {
        $out = UserOtherinfoGr::getInfo([
            'qiuzhiyixiangArrayGS'
        ]);
        if ($out['qiuzhiyixiangArrayGS']) {
            $out['qiuzhiyixiangArrayGS'] = json_decode($out['qiuzhiyixiangArrayGS'], true);
        } else {
            $out['qiuzhiyixiangArrayGS'] = [];
        }
        API::echo_json(0, $out);
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/setuser_qiuzhiyixiang_gr 修改求职意向信息公司,并设置用户求职类型为公司
     * @apiParam {array} qiuzhiyixiangArrayGS   求职意向数组
     * @apiParam {string} qiuzhiyixiangArrayGS.didian   地点 省市县用空格分隔
     * @apiParam {string} qiuzhiyixiangArrayGS.zhiwei  职位
     * @apiParam {string} qiuzhiyixiangArrayGS.qiwangxinshui   期望薪水
     * @apiParam {string} qiuzhiyixiangArrayGS.gongzuoleixing   工作类型
     * @apiParam {string} qiuzhiyixiangArrayGS.hangye   行业
     * @apiParam {string} qiuzhiyixiangArrayGS.daogangshijian   到岗时间
     * @apiSuccessExample 参数例子
     * 其中期望薪水对应类型
     *  <option value="">请选择</option>
     * <option value="1">1000元~2000元</option>
     * <option value="2">2000元~5000元</option>
     * <option value="3">5000元~10000元</option>
     * <option value="4">10000元~15000元</option>
     * <option value="5">15000元~30000元</option>
     * <option value="6">30000元以上</option>
     *
     * {"qiuzhiyixiangArrayGS":[{"didian":"\u5929\u6d25\u5e02 \u5929\u6d25\u5e02 \u548c\u5e73\u533a","zhiwei":"a","qiwangxinshui":"6","gongzuoleixing":"bb","hangye":"vv","daogangshijian":"cc"}]}
     */
    public function setuser_qiuzhiyixiang_gr($post)
    {

        $out = UserOtherinfoGr::setInfo([
            'qiuzhiyixiangArrayGS'
        ], $post);
        UsersBaseinfoGr::setIS('qiuzhiyixiangType', UsersBaseinfoGr::qiuzhiyixiangType_GS);
        UsersBaseinfoGr::setIS('isqiuzhiyixiang');
        //  exit('aa');
        API::echo_json(0, $out);
    }


    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/getqiuzhiyixiang_gc 获取求职意向信息工厂
     * @apiSuccess {array} qiuzhiyixiangArrayGC   求职意向数组
     * @apiSuccess {array} qiuzhiyixiangArrayGC.mianliaozhonglei   面料种类
     * @apiSuccess {string} qiuzhiyixiangArrayGC.mianliaozhonglei.text   标签文字
     * @apiSuccess {bool} qiuzhiyixiangArrayGC.mianliaozhonglei.on   是否选择了标签
     *
     * @apiSuccess {array} qiuzhiyixiangArrayGC.jishudengjiList   技术等级
     * @apiSuccess {string} qiuzhiyixiangArrayGC.jishudengjiList.text   标签文字
     * @apiSuccess {bool} qiuzhiyixiangArrayGC.jishudengjiList.on   是否选择了标签
     *
     * @apiSuccess {array} qiuzhiyixiangArrayGC.shanchangjinengList   擅长技能
     * @apiSuccess {string} qiuzhiyixiangArrayGC.shanchangjinengList.text   标签文字
     * @apiSuccess {bool} qiuzhiyixiangArrayGC.shanchangjinengList.on   是否选择了标签
     * @apiSuccessExample 返回
     * {"code":0,"data":{"qiuzhiyixiangArrayGC":{"mianliaozhonglei":[{"text":"\u725b\u4ed4","on":false},{"text":"\u5355\u9762\u5c3c","on":false},{"text":"\u53cc\u9762\u5c3c","on":false},{"text":"\u7fbd\u7ed2\u670d","on":false},{"text":"\u9488\u7ec7","on":false},{"text":"\u68ad\u7ec7","on":false},{"text":"\u771f\u4e1d","on":false},{"text":"\u96ea\u7eba","on":false}],"jishudengljiList":[{"text":"\u5e02\u573a\u8d27","on":false},{"text":"\u534a\u7cbe\u54c1","on":false},{"text":"\u534a\u7cbe\u54c1\u504f\u4e0a","on":false},{"text":"\u534a\u7cbe\u54c1\u504f\u4e0a","on":false},{"text":"\u5b66\u5f92","on":false},{"text":"1-2\u5e74","on":false},{"text":"3-5\u5e74","on":false},{"text":"6-10\u5e74","on":false},{"text":"10\u5e74\u4ee5\u4e0a","on":false}],"shanchangjinengList":[{"text":"\u62fc\u7f1d","on":false},{"text":"\u505a\u9886\u5b50","on":false},{"text":"\u4e0a\u9886\u5b50","on":false},{"text":"\u5f00\u53e3\u888b","on":false},{"text":"\u5927\u70eb","on":false},{"text":"\u6a21\u677f\u8f66","on":false},{"text":"\u53cc\u9488\u8f66","on":false},{"text":"\u5957\u91cc\u5e03","on":false},{"text":"\u897f\u88c5","on":false},{"text":"\u897f\u88e4","on":false},{"text":"\u88e4\u5b50","on":false},{"text":"\u5927\u8863","on":false},{"text":"\u88c5\u62c9\u94fe","on":false},{"text":"\u5c0f\u70eb","on":false},{"text":"\u538b\u7ebf","on":false},{"text":"\u5939\u514b","on":false}]}}}
     */
    public function getqiuzhiyixiang_gc($post)
    {
        $out = UserOtherinfoGr::getInfo([
            'qiuzhiyixiangArrayGC'
        ]);
        $mianliaozhonglei = [
            '牛仔', '单面尼', '双面尼', '羽绒服', '针织', '梭织', '真丝', '雪纺'
        ];
        $jishudenglji = [
            '市场货', '半精品', '半精品偏上', '学徒', '1-2年', '3-5年', '6-10年'
            , '10年以上'
        ];
        $shanchangjineng = [
            '拼缝', '做领子', '上领子', '开口袋', '大烫', '模板车', '双针车', '套里布',
            '西装', '西裤', '裤子', '大衣', '装拉链', '小烫', '压线', '夹克'
        ];
        if ($out['qiuzhiyixiangArrayGC']) {
            $out['qiuzhiyixiangArrayGC'] = json_decode($out['qiuzhiyixiangArrayGC'], true);
            if (!$out['qiuzhiyixiangArrayGC']) {
                $out['qiuzhiyixiangArrayGC'] = [];
            }
        } else {
            $out['qiuzhiyixiangArrayGC'] = [];
        }
        $userSelectMianliaozhonglei = $out['qiuzhiyixiangArrayGC']['mianliaozhonglei'] ?? [];
        $userSelectJishudenglji = $out['qiuzhiyixiangArrayGC']['jishudengjiList'] ?? [];
        $userSelectShanchangjineng = $out['qiuzhiyixiangArrayGC']['shanchangjinengList'] ?? [];
        $mianliaozhongleiList = [];
        $jishudengjiList = [];
        $shanchangjinengList = [];
        foreach ($mianliaozhonglei as $vo) {
            $mianliaozhongleiList[] = [
                'text' => $vo,
                'on' => in_array($vo, $userSelectMianliaozhonglei)
            ];
        }
        foreach ($jishudenglji as $vo) {
            $jishudengjiList[] = [
                'text' => $vo,
                'on' => in_array($vo, $userSelectJishudenglji)
            ];
        }
        foreach ($shanchangjineng as $vo) {
            $shanchangjinengList[] = [
                'text' => $vo,
                'on' => in_array($vo, $userSelectShanchangjineng)
            ];
        }
        $out['qiuzhiyixiangArrayGC'] = [
            'mianliaozhonglei' => $mianliaozhongleiList,
            'jishudengjiList' => $jishudengjiList,
            'shanchangjinengList' => $shanchangjinengList,
        ];

        API::echo_json(0, $out);
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/setqiuzhiyixiang_gc 修改求职意向信息工厂,并设置用户求职类型为工厂
     * @apiParam {string} mianliaozhonglei   面料种类 用,分隔
     * @apiParam {string} jishudengjiList   技术等级 用,分隔
     * @apiParam {string} shanchangjinengList  擅长技能 用,分隔
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function setqiuzhiyixiang_gc($post)
    {

        $qiuzhiyixiangArrayGC = [
            'mianliaozhonglei' => explode(',', $post['mianliaozhonglei']),
            'jishudengjiList' => explode(',', $post['jishudengjiList']),
            'shanchangjinengList' => explode(',', $post['shanchangjinengList']),
        ];
        // print_r($qiuzhiyixiangArrayGC);exit;
        $post['qiuzhiyixiangArrayGC'] = json_encode($qiuzhiyixiangArrayGC);
        $out = UserOtherinfoGr::setInfo([
            'qiuzhiyixiangArrayGC'
        ], $post);
        UsersBaseinfoGr::setIS('qiuzhiyixiangType', UsersBaseinfoGr::qiuzhiyixiangType_GC);
        UsersBaseinfoGr::setIS('isqiuzhiyixiang');
        //
        API::echo_json(0, $out);
    }


    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/getuser_ziwopingjia_gr 获取自我评价
     * @apiSuccess {array} gongzuojingliArray   获取家庭成员数组
     * @apiSuccessExample 返回
     * {"code":0,"data":"ok"}
     */
    public function getuser_ziwopingjia_gr($post)
    {
        $out = UserOtherinfoGr::getInfo([
            'gerennengli', 'shanchangjineng', 'aihaotechang'
        ]);

        API::echo_json(0, $out);
    }

    /**
     *
     * @apiGroup  用户 个人求职
     * @api {post} /api/app/call/setuser_ziwopingjia_gr 修改自我评价
     * @apiParam {string} jiaoyubeijingarray   家庭成员数组
     */
    public function setuser_ziwopingjia_gr($post)
    {
        $out = UserOtherinfoGr::setInfo([
            'gerennengli', 'shanchangjineng', 'aihaotechang'
        ], $post);
        UsersBaseinfoGr::setIS('isziwopingjia', 1);
        API::echo_json(0, $out);
    }


}